# Contributor: Fernando Casas Schossow <casasfernando@outlook.com>
# Maintainer: Fernando Casas Schossow <casasfernando@outlook.com>
pkgname=virglrenderer
pkgver=1.1.0
pkgrel=0
pkgdesc="A virtual 3D GPU library, that allows the guest operating system to use the host GPU to accelerate 3D rendering"
url="https://virgil3d.github.io/"
options="!check"
arch="all"
license="MIT"
makedepends="meson libva-glx-dev libdrm-dev mesa-dev libepoxy-dev python3 check-dev"
subpackages="$pkgname-dev"
source="https://gitlab.freedesktop.org/virgl/virglrenderer/-/archive/virglrenderer-$pkgver/virglrenderer-virglrenderer-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgname-$pkgver"

# secfixes:
#   0.10.3-r0:
#     - CVE-2022-0135
#     - CVE-2022-0175
#   0.8.1-r0:
#     - CVE-2019-18388
#     - CVE-2019-18389
#     - CVE-2019-18390
#     - CVE-2019-18391

build() {
	abuild-meson \
		-Db_lto=true \
		-Dtests=true \
		-Dvideo=true \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
4b121f7f20191ed01192b224b11963a718882521d6f52a5ef96504cc46364df51da308bf35a6a758077887d806ee7e200dc741f0f163083d4cedda20151402f3  virglrenderer-virglrenderer-1.1.0.tar.gz
"
